package com.example;

import io.seata.rm.datasource.DataSourceProxy;
import io.seata.rm.datasource.xa.DataSourceProxyXA;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;

import javax.sql.DataSource;

@SpringBootApplication
@EnableFeignClients
public class IndexApplication {
	public static void main(String[] args) 
	{
		ConfigurableApplicationContext run = SpringApplication.run(IndexApplication.class, args);

		// 验证代理模式
		String proxyMode = run.getEnvironment().getProperty("seata.data-source-proxy-mode");
		System.out.println("Seata DataSource Proxy Mode: " + proxyMode);

//		// 验证实际代理类
//		DataSource dataSource = run.getBean(DataSourceProxy.class);
//		System.out.println("DataSource Class: " + dataSource.getClass().getName());
		
//		DataSource bean = run.getBean(DataSourceProxyXA.class);
//		System.out.println(bean.getClass().getName());

	}
}